/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sesion.ejb;

import java.rmi.RemoteException;
import javax.annotation.Resource;
import javax.ejb.EJBException;
import javax.ejb.SessionContext;
import javax.ejb.SessionSynchronization;
import javax.ejb.Stateful;

/**
 *
 * @author Administrador
 */
@Stateful
public class Sesion2Bean implements Sesion2Remote,SessionSynchronization {
    @Resource
    SessionContext c;
    
    public void afterBegin() throws EJBException, RemoteException {
        System.out.println("afterBegin2");
    }

    public void beforeCompletion() throws EJBException, RemoteException {
        System.out.println("beforeCompletion2");
    }

    public void afterCompletion(boolean arg0) throws EJBException, RemoteException {
        System.out.println("afterCompletion2");
    }
    
    // Add business logic below. (Right-click in editor and choose
    // "EJB Methods > Add Business Method" or "Web Service > Add Operation")
    public void metodo2(){
        System.out.println("metodo2");
        c.setRollbackOnly();
    }
    
}
